#!/usr/bin/env python3
#coding:utf8

from sanic import Sanic
from wechat.view import wechat
from mqtt.view import mqtt
from mqtt.tasks import tasks
from config import SERVER_ADDR, SERVER_PORT, NUMBER_OF_WORKERS

app = Sanic(__name__)
app.blueprint(wechat, url_prefix='/wechat')
app.blueprint(mqtt, url_prefix='/mqtt')
app.static('/static', './static')

for task in tasks:
    app.add_task(task)

app.static('/favicon.ico', './static/img/home.png')

app.run(host=SERVER_ADDR, port=SERVER_PORT, debug=True, workers=NUMBER_OF_WORKERS)
